<template>
  <config-provider :locale="zh_CN">
    <div id="app">
      <router-view/>
    </div>
  </config-provider>
</template>
<script>
  import { ConfigProvider } from 'ant-design-vue';//引用
  import enUS from 'antd/lib/locale/en_US';
  import zh_CN from 'antd/lib/locale-provider/zh_CN';
  import moment from 'moment';
  import 'moment/locale/zh-cn';
  // moment.locale('en');

  export default {
    components: { ConfigProvider },
    data() {
      return {
        zh_CN,
      }
    },
    created() {
      //在页面加载时读取sessionStorage里的状态信息，如果有信息就通过Object.assign方法，返回一个新的对象，通过
      //$store.replaceState方法将新的对象替换掉原来的store对象
      if (sessionStorage.getItem("store") ) {
        this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(sessionStorage.getItem("store"))))
      }
      //在页面刷新时将vuex里的信息保存到sessionStorage里,解决刷新页面时账户信息丢失的问题
      window.addEventListener("unload",()=>{
        sessionStorage.setItem("store",JSON.stringify(this.$store.state))
      })
    },

  }

</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
.ant-table-small > .ant-table-content > .ant-table-body{
  margin: 0 !important ;
}

</style>
